const app = getApp();
Page({
	data: {
		username:'请先完善个人信息',
		userId:'请先完善个人信息', 
		imgSrc :'../../../images/header.jpg',
		listarray : [{
			listname : "个人资料",
			id:1,
			urlpath:"../userInfo/userInfo",
			imagepath:"/images/Info/showfirst/userinfo.png"
		}, {
			listname : "通知消息",
			id:2,
			urlpath:"../reminder/reminder",
			imagepath: "/images/Info/showfirst/notice.png"
		}, {
			listname : "历史记录",
			id:3,
			urlpath:"../history/history",
			imagepath: "/images/Info/showfirst/history.png"
		}, {
			listname : "我的收藏",
			id:4,
			urlpath:"../collection/collection",
			imagepath: "/images/Info/showfirst/collection.png"
		},{
			listname : "我的二维码",
			id:5,
			urlpath:"../twocode/twocode",
			imagepath: "/images/Info/showfirst/code.png"
		}
		]
	},
	onLoad: function() {
		if (app.globalData.loginInfo) {
			let imgSrc = app.globalData.loginInfo.Uicon;
			let username = app.globalData.loginInfo.Uname;
			let userId = app.globalData.loginInfo.Uid;
			let baseUrl = app.globalData.baseUrl;
			if (imgSrc) {
				this.setData({
					imgSrc : baseUrl + '/' + imgSrc,
				});
			}
			if (username) {
				this.setData({
					username:username
				});
			}
			if (userId) {
				this.setData({
					userId:userId
				});
			}
		}
	},
	onShow() {
		let uiconrefresh = app.globalData.uiconrefresh;
		let username = app.globalData.loginInfo.Uname;
		if (username) {
			this.setData({
				username:username
			});
		}
		if (uiconrefresh) {
			let baseUrl = app.globalData.baseUrl;
			let imgSrc = app.globalData.loginInfo.Uicon;
			if (imgSrc) {
				this.setData({
					imgSrc : baseUrl +'/' +imgSrc,
				});
			}
			app.globalData.uiconrefresh = false;
		}
	}
});
